package my.jwds.p824;

public class ToGoatLatin {

    public static void main(String[] args) {

        Solution obj = new Solution();
        long start = System.currentTimeMillis();
        System.out.println("运行时间:" + (System.currentTimeMillis() - start));
    }

    static class Solution {

        public String toGoatLatin(String sentence) {
            StringBuilder a = new StringBuilder();
            String[] strings = sentence.split(" ");
            StringBuilder res = new StringBuilder();
            for (String string : strings) {
                char c = Character.toLowerCase(string.charAt(0));
                if (c == 'a' || c ==  'e' || c == 'i' || c == 'o'|| c == 'u'){
                    res.append(string+"ma");
                }else{
                    res.append(string.substring(1));
                    res.append(string.charAt(0));
                    res.append("ma");
                }
                a.append("a");
                res.append(a);
                res.append(" ");
            }
            return res.substring(0,res.length()-1);
        }
    }
}